<template>
	<view class="detail" v-if="detail">
		<view class="title">{{detail.title}}</view>
		<view class="time">{{detail.createTime}}</view>
		<rich-text :nodes="detail.content|formatRichText" class="content"></rich-text>
	</view>
</template>

<script>
	import fetch from '@/common/fetch.js'
	export default{
		data(){
			return{
				detail:null
			}
		},
		onLoad(option) {
			this.getDetail(option.id)
		},
		methods:{
			getDetail(id){
				fetch.request('/index.php/index/mobile/articleDetail',{id:id},'GET').then(res=>{
					this.detail = res.data
				})
			}
		}
	}
</script>

<style>
	page,.detail{
		width: 100%;
		min-height: 100%;
		padding: 20rpx;
		box-sizing: border-box;		
	}
	.content img{
		max-width: 100%;
	}
	.title{
		font-size: 18px;
	}
	.time{
		font-size: 12px;
		color: #aaa;
		margin: 20rpx 0;
	}
</style>
